package com.dxtan90.order.impl;

import com.dxtan90.bean.Position;
import com.dxtan90.order.ARobotOrder;
import com.dxtan90.utils.PositionUtils;

import java.awt.event.KeyEvent;

/**
 * @author: shijunhao
 * @date: 2021/12/2 15:19
 * @description: 左键按下指令
 */
public class Mouse1PressOrder extends ARobotOrder {
    @Override
    public void doOperation(Position position) {
        robot.delay(OPERA_DELAY);
        robot.mouseMove(position.getCenterX(),position.getCenterY());
        robot.delay(OPERA_DELAY);
        robot.mousePress(KeyEvent.BUTTON1_MASK);
        robot.delay(OPERA_DELAY);
    }

    @Override
    public Position analysisData(String data) {
        return PositionUtils.parseXYPosition(data);
    }
}
